﻿<navigation:Page xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
  x:Class="caedisi.Inverter" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  mc:Ignorable="d" d:DesignWidth="840" d:DesignHeight="480"  
  Style="{StaticResource PageStyle}"
  DataContext="{Binding RelativeSource={RelativeSource Self}}"
  xmlns:Converters="clr-namespace:caedisi.Converters"
  xmlns:Helpers="clr-namespace:caedisi.Helpers"
  xmlns:my="clr-namespace:caedisi.Views.Controls"
                 
                 >

    <UserControl.Resources>
        <Converters:ColorToBrushConverter x:Name="ColorToBrushConverter"/>
        <Helpers:GlobalVariableProvider x:Key="GlobalVariableProvider" />
        <Converters:BoolToVisibilityConverter x:Key="NormalVisibility" TrueValue="Visible" FalseValue="Collapsed"/>
        <Converters:BoolToVisibilityConverter x:Key="InverseVisibility" TrueValue="Collapsed" FalseValue="Visible"/>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" >
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal" FlowDirection="LeftToRight">
            <Button Content="New" Click="ButtonNewInverter_Click"  Name="ButtonNewCellularAutomata" />
            <Rectangle Width="60" />
            <Button Content="Store And Go to next step" Name="ButtonStoreStates" Click="ButtonStoreStates_Click" />
            <TextBox Text="{Binding Path=CurrentInverterExecution.CurrentStep, Mode=TwoWay, NotifyOnValidationError=True}"  Width="40" IsEnabled="False"/>
            <Button Content="Input Completed" Name="ButtonDoneAndValidate" Click="ButtonInputCompleted_Click"  />
            <Rectangle Width="60" />
            <Button Content="Transfer for simulation" Name="ButtonTransferForSimulation" Click="ButtonTransferForSimulation_Click" />
            <Rectangle Width="20" />
            <Button Name="ButtonSave" Content="Save Rules" Click="ButtonSave_Click" />            
        </StackPanel>

        <!--<ScrollViewer  Grid.Row="1" x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">-->
        <Grid  Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>                   
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <ListBox Grid.Column="0" HorizontalAlignment="Stretch" SelectionMode="Single" Name="quickInfo" >
                    <!--<ListBoxItem Content="Neighbourhood" Name="quickInfoNeighbourhood" />
                    <ListBoxItem Content="Transition State" Name="quickInfoTransitionState" />
                    <ListBoxItem Content="Topology" Name="quickInfoTopology" />
                    <ListBoxItem Content="Rules" Name="quickInfoRules" />-->                    
                </ListBox>
                <sdk:GridSplitter  Grid.Column="1" HorizontalAlignment="Stretch" />

                <ScrollViewer  Grid.Column="2" x:Name="CanvasScrollViewer" Style="{StaticResource PageScrollViewerStyle}" Padding="0">
                    <!-- Start Canvas -->
                    <Grid Name="GridCellularAutomata" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="30">
                    
                    </Grid>                                                   
                    <!-- End Canvas -->
                </ScrollViewer>
                
                <sdk:GridSplitter  Grid.Column="3" HorizontalAlignment="Stretch" Name="GridSplitterRightPanel" IsEnabled="True" />
                <sdk:TabControl Grid.Column="4" HorizontalAlignment="Stretch" Name="TabControlCellularAutomataAndSimulationInfo" MaxWidth="300">                    
                    <sdk:TabItem Header="Simulation Info" Name="TabItemSimulationInfo">
                        <Grid Name="GridSimulationInfo" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <!--<Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>-->
                        
                        <StackPanel Margin="0,20">
                            <Button  Content="View CA Parameters"  Name="ButtonEditCAParameters" Click="ButtonEditInverterParameters_Click"  Height="23" />
                        </StackPanel>
                            
                        <!--<StackPanel Grid.Row="1">
                            <sdk:Label Content="End of simulation Condition" IsEnabled="False" />
                            <sdk:Label Content="(Play Mode)" IsEnabled="False" />
                            <StackPanel Orientation="Horizontal">
                                <RadioButton x:Name="radioButtonEndSimulationAllStates" GroupName="GroupEndOfSimulationOption" Content="when all cell states are" IsChecked="True" IsEnabled="True" VerticalContentAlignment="Center" VerticalAlignment="Center" Checked="radioButtonEndSimulationAllStates_Checked" />
                                <my:BasicCellControl  Grid.Row="2" Grid.Column="5" SelectedCellStateTypeId="{Binding Path=CurrentSimulation.SimulationEndConditionCellStateTypeId, Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Height="25" Width="29" />                                                                
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <RadioButton x:Name="radioButtonEndSimulationAfterNumberOfSteps" Content="after this number of steps " GroupName="GroupEndOfSimulationOption" VerticalContentAlignment="Center"  VerticalAlignment="Center" Checked="radioButtonEndSimulationAfterNumberOfSteps_Checked" />
                                <TextBox Name="TextboxEndSimulationNumberOfSteps" Width="40" Text="{Binding Path=CurrentSimulation.SimulationEndConditionNumberOfSteps, Mode=TwoWay}"/>                                
                             </StackPanel>
                            <RadioButton x:Name="radioButtonEndSimulationInfinite" Content="Never Stops (Infinite)" GroupName="GroupEndOfSimulationOption" VerticalContentAlignment="Center"  VerticalAlignment="Center" Checked="radioButtonEndSimulationInfinite_Checked" />
                            <StackPanel Orientation="Horizontal" Grid.Row="2" >
                                <sdk:Label Content="Delay between Transition (s)" IsEnabled="False" Margin="20,0,0,0"/>
                                <TextBox Name="TextboxDelayTransition" Width="40" Text="{Binding Path=CurrentSimulation.SimulationPlayModeTransitionTimeDelay, Mode=TwoWay}"/>

                            </StackPanel>
                        </StackPanel>-->

                        <StackPanel Grid.Row="2" Margin="0,20,0,0">
                            <sdk:Label Content="Additiontal Configuration" IsEnabled="False" />
                            <StackPanel Orientation="Horizontal">
                                <sdk:Label Content="Out-of-bound Cell's state" IsEnabled="False" />
                                <my:BasicCellControl  Grid.Row="2" Grid.Column="5" SelectedCellStateTypeId="{Binding Path=CurrentInverterExecution.OutOfBoundCellStateTypeId, Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Height="25" Width="29" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <CheckBox x:Name="checkBoxAutoCleanInNextStep" Content="auto-set decontaminating cell to clean" IsChecked="{Binding Path=CurrentInverterExecution.IsDecontaminatingCleanInNextStep, Mode=TwoWay}"  VerticalContentAlignment="Center" IsEnabled="False"/>         
                            </StackPanel>
                        </StackPanel>

                    </Grid>
                    </sdk:TabItem>
                    <sdk:TabItem Header="Statistics" Name="TabItemStats">
                        <Grid Name="GridCellularAutomataInfo" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                        
                        </Grid>
                 </sdk:TabItem>
            </sdk:TabControl>
            </Grid>
        <!--</ScrollViewer>-->
        <StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal" FlowDirection="LeftToRight">
            <Button x:Name="ButtonResetAllCellState" Content="Reset all Cells" Click="ButtonResetAllCellState_Click" />
            <my:BasicCellControl x:Name="BasicCellControlResetState" Grid.Row="2" Grid.Column="5"  VerticalAlignment="Center" HorizontalAlignment="Center" Height="25" Width="29" />
            <Rectangle Width="100" />
            <Rectangle Width="40" />
            <Button Content="First" Name="ButtonFirstStep" Click="ButtonFirstStep_Click"/>
            <Button Content="Previous" Name="ButtonPreviousStep" Click="ButtonPreviousStep_Click" />
            <TextBox Text="{Binding Path=CurrentInverterExecution.CurrentStep, Mode=TwoWay, NotifyOnValidationError=True}"  Width="40" IsEnabled="False"/>
            <Button Content="Next" Name="ButtonNextStep"  Click="ButtonNextStep_Click" />
            <Button Content="Last" Name="ButtonLastStep" Click="ButtonLastStep_Click"  Visibility="{Binding Path=CurrentInverterExecution.IsLastStepSet, Mode=TwoWay, Converter={StaticResource NormalVisibility}}"/>
        </StackPanel>

       
  </Grid>

</navigation:Page>